From 9373e5d2ee27f6b6fc73e412c737635d3fd74498 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 10:54:08 +0200 Subject: [PATCH 01/23] Fix 'procnear' -> ' proc near' Automatically done using: sed -i '' -e 's/procnear/ proc near/g' src/*.md --- src/chapter-01.md | 2 +- src/chapter-07.md | 4 ++-- src/chapter-09.md | 6 +++--- src/chapter-28.md | 6 +++--- src/chapter-29.md | 2 +- src/chapter-30.md | 4 ++-- src/chapter-31.md | 8 ++++---- src/chapter-32.md | 6 +++--- src/chapter-53.md | 2 +- src/chapter-54.md | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/chapter-01.md b/src/chapter-01.md index 8f4a05e..c5fa5f1 100644 --- a/src/chapter-01.md +++ b/src/chapter-01.md @@ -759,7 +759,7 @@ Parmsends .model small .code public _ChecksumChunk -_ChecksumChunkprocnear +_ChecksumChunk proc near push bp mov bp,sp push si ;save C's register variable diff --git a/src/chapter-07.md b/src/chapter-07.md index 5d73234..97dcded 100644 --- a/src/chapter-07.md +++ b/src/chapter-07.md @@ -263,7 +263,7 @@ NoByteFoundMsg db 0dh,0ah db ‘Buffer exhausted with no match.', 0dh, 0ah, ‘$' .code -Startprocnear +Start proc near mov ax,@data ;point to standard data segment mov ds,ax mov dx,offset Prompt @@ -306,7 +306,7 @@ Startendp ; byte is found ; Carry Flag = set if searched-for byte found, reset otherwise -SearchMaxLengthprocnear +SearchMaxLength proc near cld SearchMaxLengthLoop: lodsb ;get the next byte diff --git a/src/chapter-09.md b/src/chapter-09.md index c836fc7..1f50b8a 100644 --- a/src/chapter-09.md +++ b/src/chapter-09.md @@ -395,7 +395,7 @@ Parmsends .model small .code public _FindString -_FindStringprocnear +_FindString proc near push bp ;preserve caller's stack frame mov bp,sp ;point to our stack frame push si ;preserve caller's register variables @@ -492,7 +492,7 @@ Parmsends .model small .code public _FindString -_FindStringprocnear +_FindString proc near push bp ;preserve caller's stack frame mov bp,sp ;point to our stack frame push si ;preserve caller's register variables @@ -743,7 +743,7 @@ parmsends .model small .code public _Div -_Divprocnear +_Div proc near push bp ;preserve caller's stack frame mov bp,sp ;point to our stack frame push si ;preserve caller's register variables diff --git a/src/chapter-28.md b/src/chapter-28.md index 2e88c67..4576cbf 100644 --- a/src/chapter-28.md +++ b/src/chapter-28.md @@ -202,7 +202,7 @@ Startendp ; Draws the image at offset DS:SI to the current image location in ; VGA memory. ; -DrawImageprocnear +DrawImage proc near mov ax,VGA_SEGMENT mov es,ax call GetImageOffset ;ES:DI is the destination address for the @@ -518,7 +518,7 @@ Startendp ; Enables set/reset for all planes, and sets the set/reset color ; to AL. ; -SelectSetResetColorprocnear +SelectSetResetColor proc near mov dx,GC_INDEX push ax ;preserve color mov al,SET_RESET @@ -636,7 +636,7 @@ COLOR_DONT_CARE EQU 7 ;Color Don't Care register index in GC ; code segment word 'CODE' assume cs:code -Startprocnear +Start proc near ; ; Select graphics mode 12h. ; diff --git a/src/chapter-29.md b/src/chapter-29.md index da8e8dc..2bf80c9 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -574,7 +574,7 @@ Data ends ; Code segment assume cs:Code, ds:Data -Start procnear +Start proc near cld mov ax,Data mov ds,ax diff --git a/src/chapter-30.md b/src/chapter-30.md index bc390d8..4fa8d60 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -328,7 +328,7 @@ Startendp ; ; Registers altered: AL, DX ; -WaitForVerticalSyncStartprocnear +WaitForVerticalSyncStart proc near mov dx,INPUT_STATUS_0 WaitNotVerticalSync: in al,dx @@ -349,7 +349,7 @@ WaitForVerticalSyncStart endp ; ; Registers altered: AL, DX ; -WaitForVerticalSyncEndprocnear +WaitForVerticalSyncEnd proc near mov dx,INPUT_STATUS_0 WaitVerticalSync2: in al,dx diff --git a/src/chapter-31.md b/src/chapter-31.md index e5da35b..91818d8 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -491,7 +491,7 @@ WritePixelendp ; ; Registers altered: AX, CX, DX, SI, ES ; -ReadPixelprocnear +ReadPixel proc near mov ax,VGA_SEGMENT mov es,ax ;point to display memory mov ax,SCREEN_WIDTH/4 @@ -757,7 +757,7 @@ Start endp ; ; Output: none ; -Set320By400Modeprocnear +Set320By400Mode proc near ; ; First, go to normal 320x200 256-color mode, which is really a ; 320x400 256-color mode with each line scanned twice. @@ -853,7 +853,7 @@ Set320By400Mode endp ; make them slant down and to the left, 0 to make ; them vertical. ; -ColorBarsUpprocnear +ColorBarsUp proc near mov ax,VGA_SEGMENT mov es,ax ;point to display memory sub bh,bh ;start with color 0 @@ -891,7 +891,7 @@ ColorBarsUpendp ; ; Waits for the next key and returns it in AX. ; -GetNextKeyprocnear +GetNextKey proc near WaitKey: mov ah,1 int 16h diff --git a/src/chapter-32.md b/src/chapter-32.md index bba9b2f..e8df20d 100644 --- a/src/chapter-32.md +++ b/src/chapter-32.md @@ -199,7 +199,7 @@ _TEXTsegment byte public ‘CODE' ; Returns: nothing ; public _Set360x480Mode -_Set360x480Modeprocnear +_Set360x480Mode proc near push si ;preserve C register vars push di mov ax,12h ; start with mode 12h @@ -258,7 +258,7 @@ Color dw ? ;color in which to draw (in the DParms ends ; public _Draw360x480Dot -_Draw360x480Dotprocnear +_Draw360x480Dot proc near push bp ;preserve caller's BP mov bp,sp ;point to stack frame push si ;preserve C register vars @@ -306,7 +306,7 @@ ReadY dw ? ;Y coordinate from which to read RParms ends ; public _Read360x480Dot -_Read360x480Dotprocnear +_Read360x480Dot proc near push bp ;preserve caller's BP mov bp,sp ;point to stack frame push si ;preserve C register vars diff --git a/src/chapter-53.md b/src/chapter-53.md index 5bcd56e..1253897 100644 --- a/src/chapter-53.md +++ b/src/chapter-53.md @@ -199,7 +199,7 @@ SCparms ends align ALIGNMENT public -CosSin --CosSinprocnear +-CosSin proc near push bp ;preserve stack frame mov bp,sp ;set up local stack frame diff --git a/src/chapter-54.md b/src/chapter-54.md index 9bb7b63..f0b72be 100644 --- a/src/chapter-54.md +++ b/src/chapter-54.md @@ -339,7 +339,7 @@ SCparms ends alignALIGNMENT public _CosSin -_CosSin procnear +_CosSin proc near push bp ;preserve stack frame mov bp,sp ;set up local stack frame @@ -597,7 +597,7 @@ FixedMulDone: align ALIGNMENT public _XformVec -_XformVecprocnear +_XformVec proc near push bp ;preserve stack frame mov bp,sp ;set up local stack frame push si ;preserve register variables @@ -741,7 +741,7 @@ CXparms ends align ALIGNMENT public _ConcatXforms -_ConcatXformsprocnear +_ConcatXforms proc near push bp ;preserve stack frame mov bp,sp ;set up local stack frame push si ;preserve register variables From 97d436fb730d5ec4fe5d13102b6f142d34dc11cf Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 10:55:36 +0200 Subject: [PATCH 02/23] Fix 'endp' -> ' endp' Automatically done using: sed -i '' -e 's/\([^ ]\)endp/\1 endp/g' src/*.md --- src/chapter-01.md | 2 +- src/chapter-07.md | 8 ++++---- src/chapter-09.md | 6 +++--- src/chapter-28.md | 12 ++++++------ src/chapter-29.md | 2 +- src/chapter-30.md | 8 ++++---- src/chapter-31.md | 6 +++--- src/chapter-32.md | 4 ++-- src/chapter-43.md | 2 +- src/chapter-53.md | 6 +++--- src/chapter-54.md | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/chapter-01.md b/src/chapter-01.md index c5fa5f1..960d07a 100644 --- a/src/chapter-01.md +++ b/src/chapter-01.md @@ -779,7 +779,7 @@ ChecksumLoop: pop si ;restore C's register variable pop bp ret -_ChecksumChunkendp +_ChecksumChunk endp end ``` diff --git a/src/chapter-07.md b/src/chapter-07.md index 97dcded..7ba7d2d 100644 --- a/src/chapter-07.md +++ b/src/chapter-07.md @@ -289,7 +289,7 @@ PrintStatus: int 21h ;report status mov ah,4ch ;return to DOS int 21h -Startendp +Start endp ; Function to search a buffer of a specified length until either a ; specified byte or a zero byte is encountered. @@ -324,7 +324,7 @@ ByteFound: ;we found the searched-for byte stc ;return "found" status ret -SearchMaxLengthendp +SearchMaxLength endp end Start ``` @@ -403,7 +403,7 @@ PrintStatus: mov ah,4ch ;return to DOS int 21h -Startendp +Start endp ; Function to search a buffer of a specified length until either a ; specified byte or a zero byte is encountered. @@ -468,7 +468,7 @@ ByteFound: ; we found the searched-for byte stc ;return "found" status ret -SearchMaxLengthendp +SearchMaxLength endp end Start ``` diff --git a/src/chapter-09.md b/src/chapter-09.md index 1f50b8a..5ee0fac 100644 --- a/src/chapter-09.md +++ b/src/chapter-09.md @@ -458,7 +458,7 @@ FindStringDone: pop si pop bp ;restore caller's stack frame ret -_FindStringendp +_FindString endp end ``` @@ -559,7 +559,7 @@ FindStringDone: pop si pop bp ;restore caller's stack frame ret -_FindStringendp +_FindString endp end ``` @@ -778,7 +778,7 @@ DivLoop: pop si pop bp ;restore caller's stack frame ret -_Divendp +_Div endp end ``` diff --git a/src/chapter-28.md b/src/chapter-28.md index 4576cbf..7dc354b 100644 --- a/src/chapter-28.md +++ b/src/chapter-28.md @@ -197,7 +197,7 @@ DelayLoop: int 10h mov ah,4ch int 21h -Startendp +Start endp ; ; Draws the image at offset DS:SI to the current image location in ; VGA memory. @@ -233,7 +233,7 @@ DrawImageLoop: cmp al,10h ;have we done all four planes? jnz DrawImagePlaneLoop ret -DrawImageendp +DrawImage endp ; ; Copies the image from its current location in VGA memory into the ; buffer at DS:DI. @@ -274,7 +274,7 @@ GetImageLoop: push es pop ds ;restore original DS ret -GetImageendp +GetImage endp ; ; Erases the image at its current location. ; @@ -513,7 +513,7 @@ WaitKeyLoop: int 10h ;return to text mode mov ah,4ch int 21h ;done -Startendp +Start endp ; ; Enables set/reset for all planes, and sets the set/reset color ; to AL. @@ -533,7 +533,7 @@ SelectSetResetColor proc near mov al,0fh out dx,al ;enable set/reset for all planes ret -SelectSetResetColorendp +SelectSetResetColor endp code ends end Start ``` @@ -713,7 +713,7 @@ WaitKeyLoop: int 10h ;return to text mode mov ah,4ch int 21h ;done -Startendp +Start endp code ends end Start ``` diff --git a/src/chapter-29.md b/src/chapter-29.md index 2bf80c9..6f095cb 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -764,7 +764,7 @@ ColorNumberLoop: mov dx,offset ColorNumbers int 21h ;put up the attribute numbers ret -ColorNumbersUpendp +ColorNumbersUp endp ; Start endp Code ends diff --git a/src/chapter-30.md b/src/chapter-30.md index 4fa8d60..8cd1427 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -318,7 +318,7 @@ CountVerticalSyncsLoop: int 10h ;return to text mode mov ah,4ch int 21h ;return to DOS -Startendp +Start endp ;********************************************************************* ; Waits for the leading edge of the vertical sync pulse. ; @@ -360,7 +360,7 @@ WaitNotVerticalSync2: test al,08h jnz WaitNotVerticalSync2 ret -WaitForVerticalSyncEndendp +WaitForVerticalSyncEnd endp ;********************************************************************* ; Sets the start address to the value specifed by StartAddress. ; Wait for the trailing edge of vertical sync before setting so that @@ -904,7 +904,7 @@ endif int 10h ;return to text mode mov ah,4ch int 21h ;return to DOS -Startendp +Start endp ;********************************************************************* ; Waits for the leading edge of the vertical sync pulse. ; @@ -997,7 +997,7 @@ SetPelPan proc near mov al,[PelPan] out dx,al ;load the new Pel Pan setting ret -SetPelPanendp +SetPelPan endp ;********************************************************************* ; Sets the scan line the split screen starts after to the scan line ; specified by SplitScreenLine. diff --git a/src/chapter-31.md b/src/chapter-31.md index 91818d8..ebe281a 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -477,7 +477,7 @@ WritePixel proc near ; the pixel mov es:[di],bl ;draw the pixel ret -WritePixelendp +WritePixel endp ; ; Reads the color of the pixel at the specified location in 320x400 ; 256-color mode. @@ -513,7 +513,7 @@ ReadPixel proc near ; the pixel lodsbyte ptr es:[si] ;read the pixel ret -ReadPixelendp +ReadPixel endp ; ; Waits for the next key and returns it in AX. ; @@ -887,7 +887,7 @@ MAP_SELECT = MAP_SELECT shl 1 dec si ;count down lines on the screen jnz RowLoop ret -ColorBarsUpendp +ColorBarsUp endp ; ; Waits for the next key and returns it in AX. ; diff --git a/src/chapter-32.md b/src/chapter-32.md index e8df20d..05f0adc 100644 --- a/src/chapter-32.md +++ b/src/chapter-32.md @@ -239,7 +239,7 @@ _Set360x480Mode proc near pop di ;restore C register vars pop si ret -_Set360x480Modeendp +_Set360x480Mode endp ; ; Draws a pixel in the specified color at the specified ; location in 360x480 256-color mode. @@ -289,7 +289,7 @@ _Draw360x480Dot proc near pop si pop bp ;restore caller's BP ret -_Draw360x480Dotendp +_Draw360x480Dot endp ; ; Reads the color of the pixel at the specified ; location in 360x480 256-color mode. diff --git a/src/chapter-43.md b/src/chapter-43.md index 1e8736b..7e2289f 100644 --- a/src/chapter-43.md +++ b/src/chapter-43.md @@ -720,7 +720,7 @@ DrawLoop: dec dx ;count down the lines of the image jnz DrawLoop ret -DrawObjectendp +DrawObject endp ; Code ends end Start diff --git a/src/chapter-53.md b/src/chapter-53.md index 1253897..1f5905e 100644 --- a/src/chapter-53.md +++ b/src/chapter-53.md @@ -272,7 +272,7 @@ CSDone: pop bp;restore stack frame ret --CosSinendp +-CosSin endp ;===================================================================== ; Matrix multiplies Xform by SourceVec, and stores the result in ; DestVec. Multiplies a 4x4 matrix times a 4x1 matrix; the result @@ -351,7 +351,7 @@ pop di;restore register variables pop si pop bp;restore stack frame ret --XformVecendp +-XformVec endp ;===================================================================== ; Matrix multiplies SourceXform1 by SourceXform2 and stores the ; result in DestXform. Multiplies a 4x4 matrix times a 4x4 matrix; @@ -475,7 +475,7 @@ pop di;restore register variables pop si pop bp;restore stack frame ret --ConcatXformsendp +-ConcatXforms endp end ``` diff --git a/src/chapter-54.md b/src/chapter-54.md index f0b72be..466388a 100644 --- a/src/chapter-54.md +++ b/src/chapter-54.md @@ -704,7 +704,7 @@ endif ;USE386 pop si pop bp ;restore stack frame ret -_XformVecendp +_XformVec endp ;===================================================================== ; Matrix multiplies SourceXform1 by SourceXform2 and stores the From 9072e5d500becc5efb7e5fffbe762fc4ba339524 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:06:10 +0200 Subject: [PATCH 03/23] Fix various (ends) code OCR errors --- src/chapter-01.md | 2 +- src/chapter-28.md | 18 +++++++++--------- src/chapter-30.md | 4 ++-- src/chapter-31.md | 4 ++-- src/chapter-32.md | 4 ++-- src/chapter-33.md | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/chapter-01.md b/src/chapter-01.md index 960d07a..390b347 100644 --- a/src/chapter-01.md +++ b/src/chapter-01.md @@ -754,7 +754,7 @@ Parms struc Buffer dw ? BufferLength dw ? Checksum dw ? -Parmsends +Parms ends ; .model small .code diff --git a/src/chapter-28.md b/src/chapter-28.md index 7dc354b..b06f793 100644 --- a/src/chapter-28.md +++ b/src/chapter-28.md @@ -85,12 +85,12 @@ registers. ; ; By Michael Abrash ; -stacksegmentword stack 'STACK' -db512 dup (?) -stackends +stack segment word stack 'STACK' + db 512 dup (?) +stack ends ; -datasegment word 'DATA' -IMAGE_WIDTHEQU 4 ;in bytes +data segment word 'DATA' +IMAGE_WIDTH EQU 4 ;in bytes IMAGE_HEIGHT EQU 32 ;in pixels LEFT_BOUND EQU 10 ;in bytes RIGHT_BOUND EQU 66 ;in bytes @@ -105,11 +105,11 @@ READ_MAP EQU 4 ;Read Map register index in GC ; PatternPlane0 label byte db 32 dup (0ffh,0ffh,0,0) -PatternPlane1 labelbyte +PatternPlane1 label byte db 32 dup (0ffh,0,0ffh,0) -PatternPlane2 labelbyte +PatternPlane2 label byte db 32 dup (0f0h,0f0h,0f0h,0f0h) -PatternPlane3 labelbyte +PatternPlane3 label byte db 32 dup (0cch,0cch,0cch,0cch) ; ; Temporary storage for 16-color image during animation. @@ -124,7 +124,7 @@ ImagePlane3 db 32*4 dup (?) ImageX dw 40 ;in bytes ImageY dw 100 ;in pixels ImageXDirection dw 1 ;in bytes -dataends +data ends ; code segment word 'CODE' assume cs:code,ds:data diff --git a/src/chapter-30.md b/src/chapter-30.md index 8cd1427..8fed718 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -1104,8 +1104,8 @@ DoSetStartAddress: ret PanRight endp ;********************************************************************* -Codeends -endStart +Code ends +end Start ``` ### Notes on Setting and Reading Registers diff --git a/src/chapter-31.md b/src/chapter-31.md index ebe281a..6aac0bf 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -901,9 +901,9 @@ WaitKey: ret GetNextKey endp ; -Codeends +Code ends ; -endStart +end Start ``` When you run Listing 31.2, note the extremely smooth edges and fine diff --git a/src/chapter-32.md b/src/chapter-32.md index 05f0adc..5a5c0bb 100644 --- a/src/chapter-32.md +++ b/src/chapter-32.md @@ -171,7 +171,7 @@ vptbl dw 06b00h ; horz total dw 00616h ; v blank end dw 0e317h ; turn on byte mode vpend label word -_DATAends +_DATA ends ; ; Macro to output a word value to a port. ; @@ -336,7 +336,7 @@ _Read360x480Dot proc near pop bp ;restore caller's BP ret _Read360x480Dot endp -_TEX Tends +_TEXT ends end ``` diff --git a/src/chapter-33.md b/src/chapter-33.md index 9af64a5..3d77be3 100644 --- a/src/chapter-33.md +++ b/src/chapter-33.md @@ -532,7 +532,7 @@ FillVertLoop: jnz FillHorzLoop ;no, do the next column ret; - endStart + end Start ``` Note the jagged lines at the corners of the screen when you run Listing From b3144a21455b117964f0ece09a008681cfa55dd8 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:06:40 +0200 Subject: [PATCH 04/23] Startproc near -> Start proc near --- src/chapter-30.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-30.md b/src/chapter-30.md index 8fed718..e06b49e 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -763,7 +763,7 @@ Data ends Code segment assume cs:Code, ds:Data ;********************************************************************* -Startproc near +Start proc near mov ax,Data mov ds,ax ; From a4df877739ec16c75de9b02861b517296c53de8e Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:07:02 +0200 Subject: [PATCH 05/23] Datasegment -> Data segment --- src/chapter-30.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-30.md b/src/chapter-30.md index e06b49e..4ee51fc 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -751,7 +751,7 @@ MyStack segment para stack 'STACK' db 512 dup (0) MyStack ends ;********************************************************************* -Datasegment +Data segment SplitScreenLine dw ? ;line the split screen currently ; starts after StartAddress dw ? ;display memory offset at which From 03978b9651f8916371e549ee1b2d9cbb1dda8e47 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:07:47 +0200 Subject: [PATCH 06/23] Fix looping/calling OCR bugs --- src/chapter-30.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chapter-30.md b/src/chapter-30.md index 4ee51fc..9c72957 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -837,7 +837,7 @@ ColumnLoop2: ; panning effects can be seen easily inc di inc di -loopColumnLoop2 +loop ColumnLoop2 ror ax,1 ;shift pattern word dec dx jnz RowLoop2 @@ -847,7 +847,7 @@ loopColumnLoop2 ; screen jerks back and forth as the pel panning setting cycles. ; mov cx,200 ;pan 200 pixels to the left -callPanRight +call PanRight ; ; Wait for a key press (don't echo character). ; From 670082d3477fb94dade037cd944930843a94a837 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:08:17 +0200 Subject: [PATCH 07/23] Fix MAXIMUM_SCAN_LINEequ --- src/chapter-30.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-30.md b/src/chapter-30.md index 9c72957..bc8f3b8 100644 --- a/src/chapter-30.md +++ b/src/chapter-30.md @@ -146,7 +146,7 @@ SCREEN_WIDTH equ 640 SCREEN_HEIGHT equ 350 CRTC_INDEX equ 3d4h ;CRT Controller Index register OVERFLOW equ 7 ;index of Overflow reg in CRTC -MAXIMUM_SCAN_LINEequ 9 ;index of Maximum Scan Line register +MAXIMUM_SCAN_LINE equ 9 ;index of Maximum Scan Line register ; in CRTC START_ADDRESS_HIGH equ 0ch ;index of Start Address High register ; in CRTC From 2342c2d49d39c86c5cd235f24c2c34cd136eab60 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:08:49 +0200 Subject: [PATCH 08/23] Fix typo --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index 6aac0bf..c3273bc 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -37,7 +37,7 @@ the way up to 360x480—and that's with the vanilla IBM VGA! In this chapter, I'm going to focus on one of my favorite 256-color modes, which provides 320x400 resolution and two graphics pages and can -be set up with very little reof the VGA. In the next chapter, I'll +be set up with very little reprogramming of the VGA. In the next chapter, I'll discuss higher-resolution 256-color modes, and starting in Chapter 47, I'll cover the high-performance "Mode X" 256-color programming that many games use. From f87c4484c29eac0bbcea7b8437e60c68a229738f Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:09:07 +0200 Subject: [PATCH 09/23] Fix db512->db 512 --- src/chapter-29.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-29.md b/src/chapter-29.md index 6f095cb..45f7c3f 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -820,7 +820,7 @@ WAIT_KEY macro endm ; stack segment para stack ‘STACK' - db512 dup (?) + db 512 dup (?) stack ends ; Data segment word ‘DATA' From 700514a4885d09f8d915e6bba3cc79532b0004bd Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:10:09 +0200 Subject: [PATCH 10/23] Code OCR fix: lodsbyte -> lods byte --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index c3273bc..c8825ff 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -511,7 +511,7 @@ ReadPixel proc near mov dx,GC_INDEX OUT_WORD ;set to read from the proper plane for ; the pixel - lodsbyte ptr es:[si] ;read the pixel + lods byte ptr es:[si] ;read the pixel ret ReadPixel endp ; From f2025ac6e85d5346ed707b93507a5da83c2803dc Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:10:54 +0200 Subject: [PATCH 11/23] Add missing ; for ASM comment --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index c8825ff..677c870 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -341,7 +341,7 @@ LinesDone: ; call GetNextKey mov ax,0003h - int 10h text mode + int 10h ;text mode mov ah,4ch int 21h ;done ; From 6adf8f912ba43d01a833a40d8aada36823f301e8 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:11:16 +0200 Subject: [PATCH 12/23] Fix cmpcx->cmp cx --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index 677c870..7d5247f 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -309,7 +309,7 @@ ColorLoop: ; line descriptor list LineLoop: mov cx,[si+StartX] ;set the initial X coordinate - cmpcx,-1 + cmp cx,-1 jz LinesDone ;a descriptor with a -1 X ; coordinate marks the end ; of the list From 73e56070b465f6042e5f9db3203dfab47b5923b6 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:11:50 +0200 Subject: [PATCH 13/23] Fix function calling (OCR) --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index 7d5247f..e60ca76 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -702,7 +702,7 @@ Start proc near ; ; Set 320x400 256-color mode. ; -callSet320By400Mode +call Set320By400Mode ; ; We're in 320x400 256-color mode, with page 0 displayed. ; Let's fill page 0 with color bars slanting down and to the right. From b96792917b1950f77263b159511e2ff38b6c9f23 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:12:10 +0200 Subject: [PATCH 14/23] Fix more ASM calling (OCR) --- src/chapter-31.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index e60ca76..d21c061 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -722,7 +722,7 @@ call Set320By400Mode ; ; Wait for a key and flip to page 1 when one is pressed. ; - callGetNextKey + call GetNextKey CONSTANT_TO_INDEXED_REGISTER CRTC_INDEX,START_ADDRESS_HIGH,80h ;set the Start Address High register ; to 80h, for a start address of 8000h @@ -735,7 +735,7 @@ call Set320By400Mode ; ; Wait for another key and flip back to page 0 when one is pressed. ; - callGetNextKey + call GetNextKey CONSTANT_TO_INDEXED_REGISTER CRTC_INDEX,START_ADDRESS_HIGH,00h ;set the Start Address High register ; to 00h, for a start address of 0000h From 51194d49280fd0e796ebeedf8d87721b1d3a1b95 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:12:28 +0200 Subject: [PATCH 15/23] not40h -> not 40h --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index d21c061..8dae0fa 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -831,7 +831,7 @@ CONSTANT_TO_INDEXED_REGISTER SC_INDEX,MAP_MASK,0fh out dx,al inc dx in al,dx - and al,not40h ;turn off doubleword + and al,not 40h ;turn off doubleword out dx,al dec dx mov al,MODE_CONTROL From 28e420e66541bfdec3023637edc056f9bd526e13 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:13:06 +0200 Subject: [PATCH 16/23] Fix ASM OCR of macros --- src/chapter-31.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index 8dae0fa..d9215cd 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -283,7 +283,7 @@ endif ; ; Macro to output a constant value to an indexed VGA register. ; -CONSTANT_TO_INDEXED_REGISTERmacroADDRESS, INDEX, VALUE +CONSTANT_TO_INDEXED_REGISTER macro ADDRESS, INDEX, VALUE mov dx,ADDRESS mov ax,(VALUE shl 8) + INDEX OUT_WORD @@ -690,7 +690,7 @@ endif ; ; Macro to output a constant value to an indexed VGA register. ; -CONSTANT_TO_INDEXED_REGISTERmacroADDRESS, INDEX, VALUE +CONSTANT_TO_INDEXED_REGISTER macro ADDRESS, INDEX, VALUE mov dx,ADDRESS mov ax,(VALUE shl 8) + INDEX OUT_WORD From 1a87045a95f58ec52f4a4c781d30cbb7f857833e Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:13:30 +0200 Subject: [PATCH 17/23] pus h -> push --- src/chapter-31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-31.md b/src/chapter-31.md index d9215cd..677289e 100644 --- a/src/chapter-31.md +++ b/src/chapter-31.md @@ -867,7 +867,7 @@ RowLoop: ;4 pixels at each address, so ; each 320-pixel row is 80 bytes wide ; in each plane - pus h bx ;save the row-start color + push bx ;save the row-start color ColumnLoop: MAP_SELECT = 1 rept 4 ;do all 4 pixels at this address with From b9bf2eb0edc3a8e3c9b1a058c2f6f17e9301e73b Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:14:12 +0200 Subject: [PATCH 18/23] _DATAsegmentpublic -> _DATA segment public --- src/chapter-32.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-32.md b/src/chapter-32.md index 5a5c0bb..847b598 100644 --- a/src/chapter-32.md +++ b/src/chapter-32.md @@ -148,7 +148,7 @@ WORD_OUTS_OK equ 1 ;set to 0 to assemble for ; computers that can't handle ; word outs to indexed VGA registers ; -_DATAsegmentpublic byte ‘DATA' +_DATA segment public byte ‘DATA' ; ; 360x480 256-color mode CRT Controller register settings. ; (Courtesy of John Bridges.) From beff664727278d1da3b821d03f9d02c7a0c474c0 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:23:42 +0200 Subject: [PATCH 19/23] labelbyte -> label byte --- src/chapter-07.md | 4 ++-- src/chapter-29.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chapter-07.md b/src/chapter-07.md index 7ba7d2d..8707015 100644 --- a/src/chapter-07.md +++ b/src/chapter-07.md @@ -245,7 +245,7 @@ the whole point.) .stack 100h .data ; Sample string to search through. -SampleString labelbyte +SampleString label byte db ‘This is a sample string of a long enough length ' db ‘so that raw searching speed can outweigh any ' db ‘extra set-up time that may be required.',0 @@ -350,7 +350,7 @@ all the difference. .stack 100h .data ; Sample string to search through. -SampleStringlabelbyte +SampleString label byte db ‘This is a sample string of a long enough length ' db ‘so that raw searching speed can outweigh any ' db ‘extra set-up time that may be required.',0 diff --git a/src/chapter-29.md b/src/chapter-29.md index 45f7c3f..afd9703 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -557,7 +557,7 @@ x= x+1 ; Used to label the colors of the color bars. (Color values are ; filled in on the fly.) ; -ColorNumberslabelbyte +ColorNumbers label byte rept 16 db ‘000h', 0ah, 8, 8, 8, 8 endm From 7388cf370c445316379187e1b2cb052912c1bda8 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:24:18 +0200 Subject: [PATCH 20/23] loopVLineLoop -> loop VLineLoop --- src/chapter-28.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-28.md b/src/chapter-28.md index b06f793..349e792 100644 --- a/src/chapter-28.md +++ b/src/chapter-28.md @@ -435,7 +435,7 @@ VLineLoop: ; provides the data written to display ; memory, and AL is actually ignored) add di,SCREEN_WIDTH-1 ;point to the next scan line -loopVLineLoop +loop VLineLoop ; ; Select write mode 0 and read mode 1. ; From 8d29240973e68c9b1f3fd9c8656aa33d453fd80c Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:24:43 +0200 Subject: [PATCH 21/23] loopDrawDiagonalLoop -> loop DrawDiagonalLoop --- src/chapter-28.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-28.md b/src/chapter-28.md index 349e792..41b178d 100644 --- a/src/chapter-28.md +++ b/src/chapter-28.md @@ -698,7 +698,7 @@ DrawDiagonalLoop: ; point to the next scan line ror al,1 ;move the pixel mask one pixel to the right adc bx,0 ;advance to the next byte if the pixel mask wrapped -loopDrawDiagonalLoop +loop DrawDiagonalLoop ; ; Wait for a key to be pressed to end, then return to text mode and ; return to DOS. From 4b5c1696956daa2f9a79b8cdf148982f778557af Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:25:15 +0200 Subject: [PATCH 22/23] COLOR_ENTRY_LENGTHequ -> COLOR_ENTRY_LENGTH equ --- src/chapter-29.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-29.md b/src/chapter-29.md index afd9703..eb57047 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -561,7 +561,7 @@ ColorNumbers label byte rept 16 db ‘000h', 0ah, 8, 8, 8, 8 endm -COLOR_ENTRY_LENGTHequ($-ColorNumbers)/16 +COLOR_ENTRY_LENGTH equ ($-ColorNumbers)/16 db ‘$' ; CurrentColordb? From d54e14ca74153fe415e8b66dbd24f47265361130 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Thu, 21 May 2020 11:25:45 +0200 Subject: [PATCH 23/23] CurrentColordb -> CurrentColor db --- src/chapter-29.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chapter-29.md b/src/chapter-29.md index eb57047..7918865 100644 --- a/src/chapter-29.md +++ b/src/chapter-29.md @@ -564,7 +564,7 @@ ColorNumbers label byte COLOR_ENTRY_LENGTH equ ($-ColorNumbers)/16 db ‘$' ; -CurrentColordb? +CurrentColor db ? ; ; Space for the array of 16 colors we'll pass to the BIOS, plus ; an overscan setting of black.